<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
    <script src="https://cdn.staticfile.org/vue/2.2.2/vue.min.js"></script>
</head>
<body>
<div id="app">
    <h1>{{ name }}</h1>
    <button @click="login">login</button>
    <button @click="allDrivers">allDrivers</button>
    <button @click="conditionDrivers">conditionDrivers</button>
</div>
<script>
    const app = new Vue({
        el: "#app",
        data: {
            name: "555",
            prefixUrl: "/api"
        },
        methods: {
            login() {
                const user = {
                    "adminUsername": "111011",
                    "adminPassword": 555
                };
                const url = this.prefixUrl + "/admin/admin/login";

                axios.post(url, user).then((resp) => {
                    const result = resp.data;
                    if (result.data == null) {
                        console.log("空");
                    } else {
                        this.name = result.data;
                    }
                    console.log(result);
                }).catch(error => {
                    console.error('Error:', error);
                });
            },
            allDrivers() {
                const url = this.prefixUrl + "/admin/driver/allDrivers";

                axios.get(url).then((resp) => {
                    const result = resp.data;
                    if (result.data == null) {
                        console.log("空");
                    } else {
                        this.name = result.data;
                    }
                    console.log(result);
                    console.log(resp);
                }).catch(error => {
                    console.error('Error:', error);
                });
            },
            conditionDrivers() {
                const url = this.prefixUrl + "/admin/driver/conditions";

                axios.defaults.headers.common['token'] = `eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbiI6ImExMTEiLCJqdGkiOiJiMjAyYTZlOC00MGViLTQ0ZTYtOTgyNC1iZjkyYWIyNjFiZjMiLCJleHAiOjE3MDk2OTY3ODEsImlhdCI6MTcwOTYxMDM4MSwic3ViIjoiUGVyaXBoZXJhbHMiLCJpc3MiOiJUaWFtIn0.6fO5n56FfQvKQRlh0MBT6ASZrVrBvlwKIvpJbl4qCng`;
                axios.get(url, {
                    params: {
                        status: 0
                    }
                }).then((resp) => {
                    const result = resp.data;
                    if (result.data == null) {
                        console.log("空");
                    } else {
                        this.name = result.data;
                    }
                    console.log(result);
                    console.log(resp);
                }).catch(error => {
                    console.error('Error:', error);
                });
            }
        },
        created() {

        },
    });
</script>
</body>
</html>
